#include <cstdlib>
#include <iostream>
#include <ctime>
#include <fstream>
#include <sstream>
#include <queue>
#include "tree_class.h"
#include "cuda_helper.h"
using namespace std;

#ifndef __PSOCLASS_H__
#define __PSOCLASS_H__

extern "C" void EvaluateParticles(dim3 blockSize, dim3 gridSize, cNode* nodeArray, int treeLength, pNode* pNodeArray, float* priorProbability, float* likelihood);
extern "C" void Maximum(dim3 gridSize, dim3 blockSize, pNode* pNodeArray, int* maxIdx);
extern "C" void UpdateLengthDeltas(dim3 blockSize, dim3 gridSize, pNode* pNodeArray, int treeLength, int* globalBest, int* neighbourhoodBest, float4 swarmConstants, float3 randomVectors);
extern "C" void NeighbourMax(dim3 blockSize, dim3 gridSize, float* likelihood, float* likelihoodBest, int* neighbourhood, int neighbourhoodSize, int* neighbourhoodBest, pNode* pNodeArray, int treeLength);
///************************************************************************/
/* Class Definition								                        */
/************************************************************************/
class Psoml {
public:
	/************************************************************************/
	/* Public Methods							                            */
	/************************************************************************/	
	void SetParametersFromFile(char* path);
	void Run();
	float averageTime;
private:
	ofstream* outputFileStream;
	Tree phylogeny;
	int processorCount;
	int swarmSize;
	int blockCount;
	int generationMax;
	int neighbourhoodSize;
	float4 swarmConstants;
	float lengthDeltaMax;
	float lengthDeltaMin;
	float LengthMax;
	float LengthMin;
	float randomVectorMax;
	float randomVectorMin;
};

#endif